Skip to content

fix(ui): nest special-use mailboxes below their ordinary parents - #14241

Open
kesselb wants to merge 1 commit into
mainfrom
fix/mailbox-tree-parent-order
Open

kesselb wants to merge 1 commit into
mainfrom
fix/mailbox-tree-parent-order

Conversation

@kesselb

@kesselb kesselb commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Context

#13368 (comment)

Approach

2x forEach

Testing

Note: This pr only addresses the samples from hejhejonline (900001 - 900006)

--- a/lib/Service/MailManager.php
+++ b/lib/Service/MailManager.php
@@ -75,9 +75,34 @@
 	public function getMailboxes(Account $account, bool $forceSync = false): array {
 		$this->protocolFactory
 			->mailboxConnector($account)
 			->syncAll($account, $forceSync);

-		return $this->mailboxMapper->findAll($account);
+		$fake = [
+			// Stalwart (hejhejonline): parents exist, special-use children sort before them
+			[900001, 'shared/team@example.com/Sent Items', '["sent"]'],
+			[900002, 'shared/team@example.com/Deleted Items', '["trash"]'],
+			[900003, 'shared/team@example.com/Junk Mail', '["junk"]'],
+			[900004, 'shared/team@example.com/INBOX', '[]'],
+			[900005, 'shared/team@example.com', '[]'],
+			[900006, 'shared', '[]'],
+			// paramazo: parents are never listed
+			[900011, 'shared/syslog@domain.de/INBOX', '[]'],
+			[900012, 'shared/rechnung@domain.de/INBOX', '[]'],
+			[900013, 'shared/rechnung@domain.de/Backup', '[]'],
+		];
+		$mailboxes = $this->mailboxMapper->findAll($account);
+		foreach ($fake as [$id, $name, $specialUse]) {
+			$mailbox = new Mailbox();
+			$mailbox->setId($id);
+			$mailbox->setName($name);
+			$mailbox->setAccountId($account->getId());
+			$mailbox->setDelimiter('/');
+			$mailbox->setAttributes('["\\\\subscribed"]');
+			$mailbox->setSpecialUse($specialUse);
+			$mailbox->setSyncInBackground(false);
+			$mailboxes[] = $mailbox;
+		}
+		return $mailboxes;
 	}

 	/**

AI assistance

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Daniel Kesselberg <3902676+kesselb@users.noreply.github.com>
@nextcloud-command nextcloud-command added the AI assisted This PR contains AI-assisted commits label Nov 18, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review AI assisted This PR contains AI-assisted commits bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants